import request from '@/utils/request'

export function loginByUsername(username, password) {
  const data = {
    username: username,
    password: password
  }
  return request({
    url: 'login/login/merchant_login',
    method: 'get',
    params: data
  })
}

export function getCode(mobile, code_type) {
  const data = {
    mobile: mobile,
    code_type: code_type
  }
  return request({
    url: 'verify/verify_code/code',
    method: 'post',
    params: data
  })
}

export function loginCompany(username, password, code, merchant_id) {
  const data = {
    username,
    password,
    code,
    merchant_id
  }
  return request({
    url: '/login/login/admin_login_merchant',
    method: 'post',
    params: data
  })
}

export function logout() {
  return request({
    url: '/login/logout',
    method: 'post'
  })
}

export function getUserInfo(token) {
  return request({
    url: 'user/admin_user/info_by_token',
    method: 'get',
    params: { token }
  })
}

export function getRouter(token) {
  return request({
    url: 'shop_merchant_auth/admin_page/get_page_tree',
    method: 'post',
    params: { token }
  })
}
